package com.education.wisdom.service.impl;

import com.education.common.utils.Convert;
import com.education.wisdom.mapper.CatalogFreeMapper;
import com.education.wisdom.pojo.CatalogFree;
import com.education.wisdom.service.ICatalogFreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 免费精品公开课目录体系 服务层实现
 *
 * @author ruoyi
 * @date 2019-06-13
 */
@Service
public class CatalogFreeServiceImpl implements ICatalogFreeService {
    @Autowired
    private CatalogFreeMapper catalogFreeMapper;

    /**
     * 查询免费精品公开课目录体系信息
     *
     * @param catalogCode 免费精品公开课目录体系ID
     * @return 免费精品公开课目录体系信息
     */
    @Override
    public CatalogFree selectCatalogFreeById(String catalogCode) {
        return catalogFreeMapper.selectCatalogFreeById(catalogCode);
    }

    @Override
    public CatalogFree selectCatalogFreeByCatalogId(String catalogId) {
        return catalogFreeMapper.selectCatalogFreeByCatalogId(catalogId);
    }

    /**
     * 查询免费精品公开课目录体系列表
     *
     * @param catalogFree 免费精品公开课目录体系信息
     * @return 免费精品公开课目录体系集合
     */
    @Override
    public List<CatalogFree> selectCatalogFreeList(CatalogFree catalogFree) {
        return catalogFreeMapper.selectCatalogFreeList(catalogFree);
    }

    /**
     * 新增免费精品公开课目录体系
     *
     * @param catalogFree 免费精品公开课目录体系信息
     * @return 结果
     */
    @Override
    public int insertCatalogFree(CatalogFree catalogFree) {
        return catalogFreeMapper.insertCatalogFree(catalogFree);
    }

    /**
     * 修改免费精品公开课目录体系
     *
     * @param catalogFree 免费精品公开课目录体系信息
     * @return 结果
     */
    @Override
    public int updateCatalogFree(CatalogFree catalogFree) {
        return catalogFreeMapper.updateCatalogFree(catalogFree);
    }

    /**
     * 删除免费精品公开课目录体系对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCatalogFreeByIds(String ids) {
        return catalogFreeMapper.deleteCatalogFreeByIds(Convert.toStrArray(ids));
    }

    @Override
    public int deleteCatalogFreeByCatalogId(Integer catalogId) {
        return catalogFreeMapper.deleteCatalogFreeByCatalogId(catalogId);
    }

    /**
     * 根据父级ID查询数据
     *
     * @param parentId 父级ID
     * @return
     */
    @Override
    public List<CatalogFree> selectByPatentId(Integer parentId) {
        return catalogFreeMapper.selectByPatentId(parentId);
    }

    @Override
    public List<CatalogFree> selectListByUserId(String userId) {
        return catalogFreeMapper.selectListByUserId(userId);
    }

    @Override
    public CatalogFree selectByCatalogId(Integer catalogId) {
        return catalogFreeMapper.selectByCatalogId(catalogId);
    }

    @Override
    public List<CatalogFree> selectList() {
        return catalogFreeMapper.selectList();
    }

}
